<template>
	<div style="display: flex;flex-direction: column;" class="otherPage procurementInformation bidAnnouncement">
		<Header :selected="7"></Header>
		<div class="bannerArea">
			<div class="banner" :style="bgImg? 'background:url('+bgImg+') no-repeat;background-size:cover; ':''">
			</div>
		</div>
		<Navigation v-loading="loading" :items="breadcrumbItems" :menus="menus" :checked="3" :bgColor="bgColor">
		</Navigation>
		<div class="content" style="min-height: 600px;">
			<div class="content_bg" style="min-height: 600px;">

				<el-row :gutter="6">
					<el-col :span="24" class="newArea" v-for="(news, index) in data" :key="index">
						<div class="news-list">
							<el-row :gutter="6" class="news-item" :class="{ 'hover': hoverIndex === index }"
								@mouseover="hoverIndex = index" @mouseleave="hoverIndex = -1">
								<!-- <el-col :span="5" class="newsImg">
									<div>
										<el-image style="height:22vh;width:100%;" :src="news.imageUrl"></el-image>
									</div>
								</el-col> -->
								<el-col :xs="important_xs_date" :sm="3" :md="3" :lg="3" class="date">
									<div>
										<div class="day"> {{ formatDate(news.publishTime, 'dd') }}</div>
										<div class="month-year">{{ formatDate(news.publishTime, 'yyyy-MM') }}</div>
									</div>
								</el-col>
								<el-col :xs="important_xs_content" :sm="18" :md="18" :lg="18" class="newcontent">
									<div class="newcontentcontainer">
										<div class="title" @click="goToDetail(news.id)">{{ news.titles }}</div>
										<div class="description">
											<!-- {{news.content?(news.content.replace(/<[^>]+>/g, '').substring(0, 100)+"..."):""}} -->
											<div v-html="$request.formartContent(news.content)"></div>
										</div>
										<!-- 	<div class="moreInfoBtn" @click="goToDetail(news.id)">{{$t("moreDetails")}}
										</div> -->
									</div>

								</el-col>
								<el-col :xs="important_xs_btn" :sm="3" :md="3" :lg="3" class="newcontentMoreArea">
									<div class="moreInfoBtn" @click="goToDetail(news.id)">{{$t("more")}} <i
											class="el-icon-d-arrow-right"></i></div>
								</el-col>
							</el-row>
						</div>
					</el-col>
				</el-row>

				<el-row :gutter="24" type="flex" class="paginationArea">
					<el-pagination background :current-page.sync="currentPage" :page-size="pageSize"
						:layout="isShowJumper?'prev, pager, next,total,jumper ':'prev, next,total' "  :total="total"
						:prev-text="$t('previousPage')" :next-text="$t('nextPage')"
						@current-change="handleCurrentChange" />
				</el-row>

			</div>
		</div>
		<Footer></Footer>
	</div>
</template>

<script>
	import Header from '../../components/common/header/Header.vue'
	import Navigation from '../../components/common/navigation/Navigation.vue'
	import Footer from '../../components/common/footer/Footer.vue'
	import {
		fmtDate
	} from '../../utils/tools'
	import {
		procurementInformationMenu
	} from '../../utils/menu.js'
	import {
		getStore,
		setStore
	} from '../../utils/tools.js';
	// 导入您需要的模块
	import Swiper from "swiper";
	export default {
		components: {
			Header,
			Navigation,
			Footer,
			fmtDate,
			getStore,
			setStore
		},
		data() {
			return {
				loading: true,
				bgImg: '', //头部banner，默认值已绑定，有背景自动切换
				bgColor: "white", //white/red
				menus: procurementInformationMenu,
				breadcrumbItems: [{
						label: this.$t('home'),
						to: '/'
					},
					{
						label: this.$t('procurementInformation'),
						to: '/procurementInformation'
					},
					{
						label: this.$t('bidAnnouncement'),
						to: '/bidAnnouncement'
					}
				],
				hoverIndex: -1,
				data: [],
				pageSize: 10,
				total: 0,
				currentPage: 1,
				important_xs_date: 3,
				important_xs_content: 17,
				important_xs_btn: 4,
				isShowJumper: true
			};
		},
		computed: {},
		created() {},
		mounted() {
			if (window.innerWidth < 440) {
				this.important_xs_date = 5;
				this.important_xs_content = 15;
				this.important_xs_btn = 4;
				this.isShowJumper = false;
			} else if (window.innerWidth < 768) {
				this.important_xs_date = 4;
				this.important_xs_content = 16;
				this.important_xs_btn = 4;
				this.isShowJumper = false;
			}
			this.initPage();
			this.bindBg();
			this.bindList();
		},
		methods: {
			handleCurrentChange(currentPage) {
				this.currentPage = currentPage;
				setStore("bidPage", this.currentPage);
				this.bindList();
			},
			/**
			 * http://127.0.0.1:9999/openApi/purchase/getWinNoticePage
			 * 获取中标公告列表
			 */
			bindList() {
				let bidPage = parseInt(getStore("bidPage"));
				let params = {
					"pageNum": bidPage > 0 ? bidPage : this.currentPage,
					"pageSize": this.pageSize
				};
				let that = this;
				that.$request.getWinNoticePage(params).then(res => {
					this.data = res.data.records;
					this.pageSize = res.data.size;
					this.total = res.data.total;
					this.currentPage = res.data.current;
					this.loading = false;
				}).catch((error) => {
					console.log(error);
				});
			},

			/**
			 * http://127.0.0.1:9999/openApi/purchase/getWinNoticeTopImage
			 * (1)	获取中标公告顶部背景
			 */
			bindBg() {
				let params = {};
				let that = this;
				that.$request.getWinNoticeTopImage(params).then(res => {
					that.bgImg = res.data.fileUrl
				}).catch((error) => {
					console.log(error);
				});

			},
			formatDate(date, format) {
				// 自定义日期格式化方法
				// 可以使用moment.js或其他日期处理库来进行格式化
				return fmtDate(new Date(date), format);
			},

			initPage() {

			},
			goToDetail(id) {
				this.$router.push({
					name: this.$t('bidAnnouncementInfo'),
					query: {
						id: id
					}
				});
			}

		}
	}
</script>

<style scoped>
	@import url("../../components/common/css/procurementInformation/procurementInformation.css");

	.bidAnnouncement .newArea {
		height: auto;
	}

	.bidAnnouncement .paginationArea {
		height: 70px;
		line-height: 70px;
		justify-content: center;
		padding-top: 20px;
	}

	.bidAnnouncement .moreInfoBtn {
		width: 97px;
		height: 30px;
		line-height: 30px;
		border: 1px solid #EB7F20;
		border-radius: 4px;
		text-align: center;
		color: #EB7F20;
		margin: 0 auto;
	}

	.bidAnnouncement .moreInfoBtn:hover {
		background-color: #EB7F20;
		color: #FFF;
	}

	.bidAnnouncement .news-list .news-item {
		height: 14vh;
		margin-bottom: 1vh;
	}

	.bidAnnouncement .news-list .news-item .title {
		font-size: 24px;

		width: 80%;
		padding: 0px 10px;
	}

	.bidAnnouncement .news-list .news-item .description {

		font-size: 14px;
	}

	.bidAnnouncement .news-list .news-item:hover .title {
		color: #0484D7;
	}

	.bidAnnouncement .news-list .day {
		text-align: center;
		font-size: 2rem;
		color: #0484D7;
		padding-top: 2vh;
		height: 8vh;
	}

	.bidAnnouncement .news-list .month-year {
		text-align: center;
		font-size: 1.5em;
	}

	.bidAnnouncement .btn-next span {
		min-width: 50px !important;
	}

	.el-pagination span:not([class*=suffix]) {
		display: inline-block;
		font-size: 13px;
		min-width: 50px !important;
		height: 28px;
		line-height: 28px;
		vertical-align: top;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}

	.bidAnnouncement .news-item {
		margin-bottom: 20px;
		cursor: pointer;
		overflow: hidden;
		transition: transform 0.3s ease;
		/* 添加过渡效果 */
	}

	.bidAnnouncement .news-item:hover .date {
		background-color: #0484D7;
		opacity: 0.8;
		color: #FFF;

		.day {
			color: #FFF;
		}
	}

	.bidAnnouncement .news-item:hover {
		transform: scale(0.98)
	}

	::v-deep .el-pagination span:not([class*=suffix]) {
		display: inline-block;
		font-size: 13px;
		min-width: 50px;
		height: 28px;
		line-height: 28px;
		vertical-align: top;
		-webkit-box-sizing: border-box;
		box-sizing: border-box;
	}

	.newcontentMoreArea {
		overflow: hidden;
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		background-color: #F6F6F6;

		background-color: #F6F6F6;
	}

	.content_bg {
		margin: 0px auto;
		padding: 50px;

	}


	@media (min-width: 2560px) {
		.content_bg {
			width: calc(2560px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(2560/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(2560/1920*146));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(2560/1920*146));
			height: calc(1px*(2560/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(2560/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}


		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(2560/1920*65));
			line-height: calc(1px*(2560/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(2560/1920*51));
			line-height: calc(1px*(2560/1920*51));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(2560/1920*51));
			line-height: calc(1px*(2560/1920*51/2));
		}

		.newcontentMoreArea {
			height: calc(1px*(2560/1920*116));
		}
	}

	@media (max-width: 2560px) {
		.content_bg {
			width: calc(2560px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(2560/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(2560/1920*146));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(2560/1920*146));
			height: calc(1px*(2560/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(2560/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}


		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(2560/1920*65));
			line-height: calc(1px*(2560/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(2560/1920*51));
			line-height: calc(1px*(2560/1920*51));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(2560/1920*51));
			line-height: calc(1px*(2560/1920*51/2));
		}

		.newcontentMoreArea {
			height: calc(1px*(2560/1920*116));
		}
	}

	@media (max-width: 2320px) {
		.content_bg {
			width: calc(2320px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(2320/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(2320/1920*146));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(2320/1920*146));
			height: calc(1px*(2320/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(2320/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}


		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(2320/1920*65));
			line-height: calc(1px*(2320/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(2320/1920*51));
			line-height: calc(1px*(2320/1920*51));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(2320/1920*51));
			line-height: calc(1px*(2320/1920*51/2));
		}

		.newcontentMoreArea {
			height: calc(1px*(2320/1920*116));
		}
	}

	@media (max-width: 2120px) {
		.content_bg {
			width: calc(2120px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(2120/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(2120/1920*146));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(2120/1920*146));
			height: calc(1px*(2120/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(2120/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}


		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(2120/1920*65));
			line-height: calc(1px*(2120/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(2120/1920*51));
			line-height: calc(1px*(2120/1920*51));
		}

		.newcontentMoreArea {
			height: calc(1px*(2120/1920*116));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(2120/1920*51));
			line-height: calc(1px*(2120/1920*51/2));
		}
	}

	@media (max-width: 1920px) {
		.content_bg {
			width: calc(1920px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: 116px;
		}

		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: 65px;
			line-height: 65px;
		}

		.bidAnnouncement .news-list .title {
			height: 51px;
			line-height: 51px;
		}

		.bidAnnouncement .news-list .description {
			height: 51px;
			line-height: calc(51px/2);
		}

		.bidAnnouncement .newArea {
			height: 146px;
		}

		.bidAnnouncement .news-list .news-item {
			height: 146px;
		}

		.bidAnnouncement .news-list .newcontent {
			height: 116px;
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}

		.newcontentMoreArea {
			height: 116px;
		}

	}

	@media (max-width: 1720px) {


		.content_bg {
			width: calc(1720px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(1720/1920*116));
		}

		.newcontentMoreArea {
			height: calc(1px*(1720/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(1720/1920*146));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(1720/1920*146));
			height: calc(1px*(1720/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(1720/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}

		.bidAnnouncement .moreInfoBtn {
			height: 30px;
			line-height: 30px;
		}

		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(1720/1920*65));
			line-height: calc(1px*(1720/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(1720/1920*51));
			line-height: calc(1px*(1720/1920*51));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(1720/1920*51));
			line-height: calc(1px*(1720/1920*51/2));
		}
	}

	@media (max-width: 1520px) {
		.content_bg {
			width: calc(1520px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(1520/1920*116));
		}

		.newcontentMoreArea {
			height: calc(1px*(1520/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(1520/1920*146));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(1520/1920*146));
			height: calc(1px*(1520/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(1520/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}


		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(1520/1920*65));
			line-height: calc(1px*(1520/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(1520/1920*51));
			line-height: calc(1px*(1520/1920*51));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(1520/1920*51));
			line-height: calc(1px*(1520/1920*51/2));
		}
	}

	@media (max-width: 1366px) {
		.content_bg {
			width: calc(1366px * 0.8);
		}

		.bidAnnouncement .news-list .date {
			height: calc(1px*(1366/1920*116));
		}

		.bidAnnouncement .newArea {
			height: calc(1px*(1366/1920*146));
		}

		.newcontentMoreArea {
			height: calc(1px*(1366/1920*116));
		}

		.bidAnnouncement .news-list .news-item {
			height: calc(1px*(1366/1920*146));
			height: calc(1px*(1366/1920*146));

		}

		.bidAnnouncement .news-list .newcontent {
			height: calc(1px*(1366/1920*116));
		}

		.bidAnnouncement .news-list .newcontent .newcontentcontainer {
			height: 100%;
		}


		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: calc(1px*(1366/1920*65));
			line-height: calc(1px*(1366/1920*65));
		}

		.bidAnnouncement .news-list .title {
			height: calc(1px*(1366/1920*51));
			line-height: calc(1px*(1366/1920*51));
		}

		.bidAnnouncement .news-list .description {
			height: calc(1px*(1366/1920*51));
			line-height: calc(1px*(1366/1920*51/2));
		}
	}

	@media (max-width: 1120px) {
		.content_bg {
			width: 100%
		}
	}

	@media (max-width: 1024px) {}

	@media (max-width: 900px) {}

	@media (max-width:768px) {

		.bidAnnouncement .content,
		.bidAnnouncement .content_bg {
			padding: 5px
		}

		.bidAnnouncement .news-list .day {
			padding-top: 0px;
			height: 50px;
			line-height: 64px;
			font-size: 30px;
			color: #FFF;
		}

		.bidAnnouncement .news-list .month-year {
			font-size: 12px;
		}

		.bidAnnouncement .news-list .news-item .title {
			font-size: 16px;
			height: 30px;
			line-height: 30px;
		}

		.bidAnnouncement .moreInfoBtn {
			width: 50px !important;
			height: 30px;
			line-height: 30px;
			font-size: 8px;
		}

		.bidAnnouncement .news-list .news-item .description {
			height: 50px;
			line-height: 28px;
			font-size: 12px;
		}
	}
</style>
